/*
 * Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2019. All rights reserved.
 * Description: performance timestamp log.
 * Author: HiMobileCam Reference Develop Team
 * Create: 2019-06-28
 */

#ifndef HI_TIMESTAMP_H
#define HI_TIMESTAMP_H

#include "hi_type.h"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */

typedef struct {
    HI_U32 stamp;
    HI_CHAR *func;
    HI_U32 line;
    HI_U32 type;
}HI_TIMESTAMP_Item;

/* TimeStamp log funtions */
HI_S32 HI_TIMESTAMP_Init(HI_UINTPTR_T phyMemAddr, HI_BOOL cleanMem);
HI_VOID HI_TIMESTAMP_Deinit(HI_VOID);
HI_S32 HI_TIMESTAMP_Mark(const HI_CHAR *func, HI_U32 line, HI_U32 type);
HI_S32 HI_TIMESTAMP_MarkEx(const HI_TIMESTAMP_Item *item);
HI_S32 HI_TIMESTAMP_Clean(HI_VOID);
HI_S32 HI_TIMESTAMP_Print(HI_U32 type);
HI_U32 HI_TIMESTAMP_GetMs(HI_VOID);


#define CFG_TIME_STAMP_ON

/* TimeStamp log macro define */
#ifdef CFG_TIME_STAMP_ON
#define HI_TIME_STAMP HI_TIMESTAMP_Mark(__func__, __LINE__, 0)
#define HI_TIME_CLEAN HI_TIMESTAMP_Clean()
#define HI_TIME_PRINT HI_TIMESTAMP_Print(0)
#else
#define HI_TIME_STAMP
#define HI_TIME_CLEAN
#define HI_TIME_PRINT
#endif

#ifdef CFG_PERFORMANCE_TIME_STAMP
#define HI_PERFORMANCE_TIME_STAMP HI_TIME_STAMP
#else
#define HI_PERFORMANCE_TIME_STAMP
#endif

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */

#endif /* End of #ifndef HI_TIMESTAMP_H */

